public class CheckPermutation {
    public boolean code(String ss1, String ss2) {
        char[] s1 = ss1.toCharArray();
        char[] s2 = ss2.toCharArray();

        if (s1.length != s2.length){
            return false;
        }

        int n = s1.length;
        int[] hash = new int[26];

        for (char ch : s1){
            hash[ch - 'a']++;
        }

        for (char ch : s2){
            hash[ch - 'a']--;
        }

        for(int x : hash){
            if (x != 0){
                return false;
            }
        }

        return true;
    }
}
